<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>主页</title>
    <link rel="stylesheet" href="css/reset.css">
    <!-- <link rel="stylesheet" href="css/mui.min.css"> -->
    <link rel="stylesheet" href="css/jiazai.css">
    <link rel="stylesheet" href="css/animate.css">
    <link rel="stylesheet" href="css/index.css">
    <style>
        #noti-com {
            position: fixed;
            top: 0;
            right: 0;
            left: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
        }
        
        .noti-dom {
            width: 100%;
            max-height: 40vh;
            overflow: hidden;
            margin-bottom: 10px;
            background: white;
            border-radius: 10px;
        }
    </style>
</head>

<body style="background:#2a2c35;">
    <div id='app'>

        <!-- 加载中动画 -->
        <div id='jiazai-ani' v-if='jiazai'>
            <div class="arc"></div>
            <h1><span>LOADING</span></h1>
        </div>
        <!-- 加载中动画 -->

        <!-- 通知 -->
        <div id='noti-com' class='dis-cen' v-if='noti'>
            <div style='width:75%;'>
                <div class='noti-dom' @click='goNotice'>
                    <img :src="noti.news_img" style="width:100%;">
                </div>
                <p class='dis-cen' @click='noti=false;'>
                    <img src="./img/close.png" style="width:35px;height:35px;">
                </p>
            </div>
        </div>
        <!-- 通知 -->


        <!-- 钱包 -->
        <div id='wallet-wrap' v-if='offBomType==1'>
            <div style='height:2px;background:transparent;'></div>
            <div style="padding:0 20px;">
                <div class='get-mon-info'>
                    <div class='hea-tit dis-spa'>
                        <div class='dis-spa'>
                            <!-- <img src="./img/why.svg" width="15px" height="15px" style="opacity:0;"> -->
                            <span style="margin-left:5px;font-size: 13px;">活期加速</span>
                        </div>
                        <div>活期CC个数</div>
                        <div>
                            <img @click="_openHref({url:'bill-all.html',id:'billAll'})" src="./img/bill.svg" height="24px">
                        </div>
                    </div>
                    <div class='hava-money dis-spa'>
                        <div>
                            <span v-if='offHuoqi' v-text='wallet.money'>0.00</span>
                            <span v-else>*******</span>
                        </div>
                        <img :src="offHuoqi?'./img/yes.svg':'./img/no-yan.svg'" @click='offHuoqi=!offHuoqi' width="20px">
                    </div>
                    <!-- <div class='money-notice'>
                        暂无活期收益
                    </div> -->
                    <div class='money-notice all-jieshou-wrap'>
                        <div class='dis-spa jiesuo-wrap dinqi-jieshou-wrap'>
                            <div>
                                <h2>昨日活期加速</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(wallet.currentyesterday,2)" readonly>
                            </div>
                            <span></span>
                            <div>
                                <h2>全部活期加速</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(wallet.currentyall,2)" readonly>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- <div class='wallet-fun-wrap dis-spa'>
                <div @click="_openHref({url:'recharge.html',id:'recharge'})">
                    <img src="./img/add.png" width="55px" height="55px">
                    <h3>充值</h3>
                    <p>交易所账户充值</p>
                </div>
                <div @click="_openHref({url:'get-money.html',id:'getMoney'})">
                    <img src="./img/get-mon.png" width="55px" height="55px">
                    <h3>提现</h3>
                    <p>提现到交易所</p>
                </div>
                <div @click="_openHref({url:'cun-dinqi.html',id:'cunDinqi'})">
                    <img src="./img/cun-regular.png" width="55px" height="55px">
                    <h3>存定期</h3>
                    <p v-text='wallet.text'>最高收益300%</p>
                </div>
            </div> -->
            <div class='wallet-fun-wrap dis-spa'>
                <div @click="_openHref({url:'trans-in.html',id:'transIn'});">
                    <img src="./img/trans-in.png" width="47px" height="47px">
                    <h3>转入</h3>
                    <p>余额转入至活期</p>
                </div>
                <div @click="_openHref({url:'trans-out.html',id:'transOut'});">
                    <img src="./img/trans-out.png" width="47px" height="47px">
                    <h3>转出</h3>
                    <p>活期转出至余额</p>
                </div>
                <div @click="_openHref({url:'demand.html',id:'demand'});">
                    <img src="./img/cun-regular.png" width="47px" height="47px">
                    <h3>矿池合约</h3>
                    <p v-text='wallet.aridmoney+"枚"'>正常收益转出</p>
                </div>
            </div>
            <div class='dis-spa jiesuo-wrap'>
                <div>
                    <h2>昨日总加速</h2>
                    <p>（CC个数）</p>
                    <input type="text" :value="_toFixed(wallet.yesterday,2)" readonly>
                </div>
                <span></span>
                <div>
                    <h2>全部总加速</h2>
                    <p>（CC个数）</p>
                    <input type="text" :value="_toFixed(wallet.all,2)" readonly>
                </div>
            </div>
            <div class='like-jie-record dis-spa'>
                <button @click="_openHref({url:'unlock-record.html',id:'unlockRecord'})">查看我的释放记录</button>
            </div>
        </div>
        <!-- 钱包 -->

        <!-- 定期 -->
        <div id='regular-wrap' v-if='offBomType==2'>
            <!-- 定期变化固定头部 -->
            <div id='dinqi-gudin-tit' class='dis-spa' style="padding:0 20px 20px;display: none;">
                <p style="color:#9197ae;letter-spacing: 1px;">
                    <span v-text='regularData.text3'>共2条定期待</span>
                </p>
                <img @click="_openHref({url:'cun-dinqi.html',id:'cunDinqi'})" src="./img/icon-add.svg" width="15px" height="15px">
            </div>
            <!-- 定期变化固定头部 -->

            <div style="padding:0 20px;">
                <div class='get-mon-info'>
                    <div class='hea-tit dis-spa'>
                        <div class='dis-spa'>
                            <!-- <img src="./img/why.svg" width="15px" height="15px"> -->
                            <span style="margin-left:5px;font-size: 13px;">定期释放</span>
                        </div>
                        <div>待释放CC个数</div>
                        <div>
                            <img @click="_openHref({url:'bill-all.html',id:'billAll'})" src="./img/bill.svg" height="24px">
                        </div>
                    </div>
                    <div class='hava-money dis-spa'>
                        <div>
                            <span v-if='offDinqi' v-text='regularData.nounall'>13415415454</span>
                            <span v-else>*******</span>
                        </div>
                        <img @click='offDinqi=!offDinqi' :src="offDinqi?'./img/yes.svg':'./img/no-yan.svg'" width="20px">
                    </div>
                    <div class='money-notice all-jieshou-wrap'>
                        <div class='dis-spa jiesuo-wrap dinqi-jieshou-wrap'>
                            <div>
                                <h2>昨日定期释放</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(regularData.yesterday,2)" readonly>
                            </div>
                            <span></span>
                            <div>
                                <h2>全部定期释放</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(regularData.all,2)" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <div id='dinqi-scroll' class='dis-spa' style="padding: 20px 0">
                    <p style="color:#9197ae;letter-spacing: 1px;">
                        <span v-text='regularData.text3'>点击右侧"+"号添加定期收益</span>
                    </p>
                    <img @click="_openHref({url:'cun-dinqi.html',id:'cunDinqi'})" src="./img/icon-add.svg" width="15px" height="15px">
                </div>
            </div>
            <div class="shou-list-wrap">
                <div v-if='regularData.list.length'>
                    <div class='shou-list' v-for='(val,index) in regularData.list' :key='index'>
                        <div style="padding:10px 0;border-bottom: 1px solid rgba(35, 34, 34, .2);">
                            <h1 class='dis-spa shou-list-money'>
                                <span v-text='_toFixed(val.regularmoneylock,2)'>21454534123</span>
                                <span v-text='_toFixed(val.eday,2)'>1800</span>
                            </h1>
                            <p class='dis-spa shou-list-font'>
                                <span>待收益（本金+返利）</span>
                                <span v-text='val.text1'>每日6%</span>
                            </p>
                        </div>
                        <div class='dis-spa shou-list-info' @click="dinqiInfo(val)">
                            <p v-text='val.text2'>
                                <span>2018年12月1日</span> 存入：
                                <span>30000</span>
                            </p>
                            <p class='dis-spa'>
                                <span>详情</span>
                                <img src="./img/right.svg" width="15px">
                            </p>
                        </div>
                    </div>
                </div>
                <div v-else>
                    <div class='no-shou'>
                        <img src="./img/no-shou.png" width="100px">
                        <button @click="_openHref({url:'cun-dinqi.html',id:'cunDinqi'})">添加定期收益</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 定期 -->

        <!-- 邀请 -->
        <div id='invitation-wrap' v-if='offBomType==3'>

            <!-- 邀请变化固定头部 -->
            <div id='invitation-scrll-tit' style="display:none;">
                <div class='dis-spa' style="padding-bottom:20px;">
                    <p style="color:#9197ae;letter-spacing: 1px;">
                        <span v-text='inviData.text'>点击右侧"+"号邀请好友吧</span>
                    </p>
                    <img src="./img/icon-add.svg" @click="_openHref({url:'invitation-friend.html',id:'invitationFriend',bg:'#5140b4'})" width="15px" height="15px">
                </div>
                <div class='change-fri-tit'>
                    <span @click="inviPage=1;inviJibie=1;inviData.lists=[];inviNodata=false;invitaData();" :class="{'chan-fri-active':inviJibie==1}">一级好友</span>
                    <span @click="inviPage=1;inviJibie=2;inviData.lists=[];inviNodata=false;invitaData();" :class="{'chan-fri-active':inviJibie==2}">二级好友</span>
                </div>
            </div>
            <!-- 邀请变化固定头部 -->

            <div style="padding:0 20px;">
                <div class='get-mon-info'>
                    <div class='hea-tit dis-spa'>
                        <div class='dis-spa'>
                            <!-- <img src="./img/why.svg" width="15px" height="15px"> -->
                            <span style="margin-left:5px;font-size: 13px;">邀请加速</span>
                        </div>
                        <div style="opacity:0;">待释放CC个数</div>
                        <div>
                            <img @click="_openHref({url:'bill-all.html',id:'billAll'})" src="./img/bill.svg" height="24px">
                        </div>
                    </div>
                    <div class='dis-spa jiesuo-wrap dinqi-jieshou-wrap friend-tit-wrap'>
                        <div class='firend-tit'>
                            <p>一级好友</p>
                            <p>
                                <span v-text='inviData.one'>1512343532423412341321321324</span>
                                <span style="font-size:14px;">人</span>
                            </p>
                        </div>
                        <div class='firend-tit'>
                            <p>二级好友</p>
                            <p>
                                <span v-text='inviData.two'>1354</span>
                                <span style="font-size:14px;">人</span>
                            </p>
                        </div>
                    </div>
                    <div class='money-notice all-jieshou-wrap'>
                        <!-- <span v-if='false'>暂无邀请收益</span> -->
                        <div class='dis-spa jiesuo-wrap dinqi-jieshou-wrap'>
                            <div>
                                <h2>昨日邀请加速</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(inviData.yesterday,2)" readonly>
                            </div>
                            <span></span>
                            <div>
                                <h2>全部邀请加速</h2>
                                <p>（CC个数）</p>
                                <input type="text" :value="_toFixed(inviData.all,2)" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <div class='dis-spa' id='yaoqin-scroll-tit' style="padding: 20px 0">
                    <p style="color:#9197ae;letter-spacing: 1px;">
                        <span v-text='inviData.text'>点击右侧"+"号邀请好友吧</span>
                    </p>
                    <img @click="_openHref({url:'invitation-friend.html',id:'invitationFriend',bg:'#5140b4'})" src="./img/icon-add.svg" width="15px" height="15px">
                </div>
            </div>
            <div class="shou-list-wrap">
                <div>
                    <div class='change-fri-tit'>
                        <span @click="inviPage=1;inviJibie=1;inviData.lists=[];inviNodata=false;invitaData();" :class="{'chan-fri-active':inviJibie==1}">一级好友</span>
                        <span @click="inviPage=1;inviJibie=2;inviData.lists=[];inviNodata=false;invitaData();" :class="{'chan-fri-active':inviJibie==2}">二级好友</span>
                    </div>
                    <div class='shou-list' v-for='(val,index) in inviData.lists' :key='index' style="padding: 8px 20px;margin:0;border-bottom: 1px solid rgba(0,0,0,.2);">
                        <div class='dis-spa' style="padding:10px 0;">
                            <div style="flex:1 1 0;width:100%;">
                                <h1 class='dis-spa shou-list-money'>
                                    <span v-text='val.text1'>21454534123</span>
                                    <span v-text='val.text2'>1800</span>
                                </h1>
                                <p class='dis-spa shou-list-font'>
                                    <span v-text='val.text3'>待收益（本金+返利）</span>
                                    <span v-text='val.text4'>每日6%</span>
                                </p>
                            </div>
                            <!-- <img style="flex:0 0 15px;margin-left:5px;" src="./img/right.svg" width="15px"> -->
                        </div>
                    </div>
                    <div v-if='inviData.lists.length' id='ready-new-data' style="height:50px;font-size: 15px;color: #9197ae;text-align: center;line-height: 50px;">
                        暂无更多数据
                    </div>
                </div>
                <div v-if='!inviData.lists.length'>
                    <div class='no-shou'>
                        <img src="./img/no-shou.png" width="100px">
                        <button @click="_openHref({url:'invitation-friend.html',id:'invitationFriend',bg:'#5140b4'})">邀请好友</button>
                    </div>
                </div>

            </div>
        </div>
        <!-- 邀请 -->

        <!-- 我的 -->
        <div id='my-wrap' v-if='offBomType==4'>
            <div class='my-top'>
                <p class='dis-spa'>
                    <img @click="_openHref({url:'set.html',id:'set'})" src="./img/set.svg" width="18px" height="18px">
                    <img @click="_openHref({url:'invitation-friend.html',id:'invitationFriend',bg:'#5140b4'})" src="./img/add-white.svg" width="15px" height="15px;">
                </p>
                <div class='account-money-wrap'>
                    <p>账户余额</p>
                    <p>(cc)</p>
                    <p v-text='myData.text0'>1546456.41445</p>
                </div>
                <div class='wallet-fun-wrap dis-spa my-oth-meth'>
                    <div @click="_openHref({url:'recharge.html',id:'recharge'})">
                        <img src="./img/blue-in.svg" width="30px" height="30px">
                        <h3>充值</h3>
                    </div>
                    <div @click="_openHref({url:'get-money.html',id:'getMoney'})">
                        <img src="./img/blue-out.svg" width="30px" height="30px">
                        <h3>提现</h3>
                    </div>
                    <div @click="_openHref({url:'cun-dinqi.html',id:'cunDinqi'})">
                        <img src="./img/cun.svg" width="30px" height="30px">
                        <h3>存定期</h3>
                    </div>
                </div>
            </div>
            <div class='my-list'>
                <div class='dis-spa' @click="_openHref({url:'my-shichang.html',id:'myshichang'})">
                    <div class='dis-spa'>
                        <img src="./img/my-shichang.svg" width="20px" height="20px">
                        <span>我的市场</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click='authen'>
                    <div class='dis-spa'>
                        <img src="./img/unlock.svg" width="20px" height="20px">
                        <span>实名认证</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click="_openHref({url:'my-account.html',id:'myAccount'})">
                    <div class='dis-spa'>
                        <img src="./img/my.svg" width="20px" height="20px">
                        <span>我的账号</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click="_openHref({url:'unlock-record.html',id:'unlockRecord'})">
                    <div class='dis-spa'>
                        <img src="./img/my-bill.svg" width="20px" height="20px">
                        <span>释放记录</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click='setTran'>
                    <div class='dis-spa'>
                        <img src="./img/unlock.svg" width="20px" height="20px">
                        <span>交易密码设置</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click="_openHref({url:'shou-jie-info.html',id:'shouJieInfo'})">
                    <div class='dis-spa'>
                        <img src="./img/notice.svg" width="20px" height="20px">
                        <span>公告/资讯</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click="_openHref({url:'find-we.html',id:'findWe'})">
                    <div class='dis-spa'>
                        <img src="./img/notice.svg" width="20px" height="20px">
                        <span>关于我们</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
                <div class='dis-spa' @click="_openHref({url:'update.html',id:'update'})" style='padding:20px 20px 60px;'>
                    <div class='dis-spa'>
                        <img src="./img/refresh.svg" width="20px" height="20px">
                        <span>检查更新Coindapp</span>
                    </div>
                    <img src="./img/right.svg" width="15px" height="15px">
                </div>
            </div>
        </div>
        <!-- 我的 -->

        <div id='fixed-bottom-controller'>
            <div @click='toggleBottom("1")' :class="{'fixed-active':offBomType==1}">
                <img :src="offBomType==1?'./img/wallet-blue.svg':'./img/wallet-hui.svg'" width="28px" height="28px">
                <span>钱包</span>
            </div>
            <div @click='toggleBottom("2")' :class="{'fixed-active':offBomType==2}">
                <img :src="offBomType==2?'./img/dinqi-blue.svg':'./img/dinqi-hui.svg'" width="28px" height="28px">
                <span>定期</span>
            </div>
            <div @click='toggleBottom("3")' :class="{'fixed-active':offBomType==3}">
                <img :src="offBomType==3?'./img/invi-blue.svg':'./img/invi-hui.svg'" width="28px" height="28px">
                <span>邀请</span>
            </div>
            <div @click='toggleBottom("4");console.log(plus.webview.all().length)' :class="{'fixed-active':offBomType==4}">
                <img :src="offBomType==4?'./img/my-blue.svg':'./img/my-hui.svg'" width="28px" height="28px">
                <span>我的</span>
            </div>
        </div>
    </div>
    <script src="js/comm.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/update.js"></script>
    <script src="js/mui.min.js"></script>

    <script>
        //修改密码回来
        var back = function() {
            var index = plus.webview.currentWebview();
            var all = plus.webview.all();
            var indexUrl = index.getURL();
            setTimeout(function() {
                for (var i = 0; i < all.length; i++) {
                    if (all[i].getURL() != indexUrl) {
                        all[i].hide();
                    }
                }
            }, 800);
            setTimeout(function() {
                for (var i = 0; i < all.length; i++) {
                    if (all[i].getURL() != indexUrl) {
                        all[i].close('none');
                    }
                }
            }, 1500);
        };
        //实名认证了回来刷新数据
        var refreMy=function(){
        	app.myIndex();
        };
        // cc_user
        // {"userid":"4","phone":"18875027065","is_frozen":"2","session":"Yc2cNt0obk2etnlbl80"}
        var app = new Vue({
            el: '#app',
            data: {
                jiazai: false,
                //顶部菜单控制  1：钱包  2：定期  3：邀请  4：我的
                offBomType: 1,
                //控制活期余额显示
                offHuoqi: true,
                //控制定期余额显示
                offDinqi: true,
                //邀请页数据
                inviData: {},
                //邀请菜单的分页
                inviPage: 1,
                //邀请菜单的几级好友
                inviJibie: 1,
                //钱包数据
                wallet: {
                    "money": "0.0",
                    "yesterday": 0,
                    "all": 0,
                    "text": "最高收益300%",
                    "aridmoney": 0
                },
                //定期数据
                regularData: {
                    "nounall": 0,
                    "text3": "共0条定期待",
                    "yesterday": 0,
                    "all": 0,
                    "list": []
                },
                //我的数据
                myData: {},
                //默认邀请还有数据  true:没有数据
                inviNodata: false,
                //通知数据
                noti: {}
            },
            created: function() {
                this.init();
                var This = this;
                _post(GO_GAO, {}, function(data) {
                    if (data.status == 1 && data.back.is_open == 2) {
                        This.noti = data.back;
                    }
                });
            },
            methods: {
                //底部菜单切换
                toggleBottom: function(val) {
                    var This = this;
                    switch (val) {
                        case '1':
                            //钱包
                            This.init();
                            This.offBomType = 1;
                            break;
                        case '2':
                            //定期
                            This.regular();
                            This.offBomType = 2;
                            setTimeout(function() {
                                This.dinqiScroll();
                            }, 20);
                            break;
                        case '3':
                            //邀请
                            This.offBomType = 3;
                            This.inviPage = 1;
                            This.inviNodata = false;
                            This.invitaData();
                            setTimeout(function() {
                                This.inviScroll();
                            }, 400);
                            break;
                        case '4':
                            //我的
                            This.offBomType = 4;
                            This.myIndex();
                            break;
                    }
                },
                //进入实名认证一套
                authen:function(){
                	var json={};
                	if(this.myData.realname&&this.myData.number){
                		json.realname=this.myData.realname;
                		json.number=this.myData.number;
                	}
                	if(this.myData.certification=='0'){
                		//没提交资料
                		_openHref({
	                		url:'authen-tication.html',
	                		id:'authenTication'
	                	});
	                	return;
                	}
                	if(this.myData.certification=='3'){
                		//审核失败
                		_toast('申请被驳回');
                		setTimeout(function(){
                			_openHref({
		                		url:'authen-tication.html',
		                		id:'authenTication'
		                	});
                		},1500);
                		return;
                	}
                	var web=_openHref({
                		url:'authen-tication.html',
                		id:'authenTication'
                	});
                	if(this.myData.certification=='1'){
                		//审核中
                		json.positive=HTTP+this.myData.positive;
                		json.opposite=HTTP+this.myData.opposite;
                		json.hold=HTTP+this.myData.hold;
                		setTimeout(function(){
                			web.evalJS("audit('"+JSON.stringify(json)+"')");
                		},300);
                	}
                	if(this.myData.certification=='2'){
                		//审核通过
                		setTimeout(function(){
                			web.evalJS("yes('"+JSON.stringify(json)+"')");
                		},300);
                	}
                },
                //app首页
                init: function() {
                    var This = this;
                    var user = JSON.parse(localStorage.getItem('cc_user'));
                    This.jiazai = true;
                    _post(APP_INDEX, {
                        userid: user.userid,
                        session: user.session
                    }, function(data) {
                        This.jiazai = false;
                        if (data.status == 1) {
                            This.wallet = data.back;
                        }
                    });
                },
                //定期页
                regular: function() {
                    var This = this;
                    var user = JSON.parse(localStorage.getItem('cc_user'));
                    This.jiazai = true;
                    _post(DINQI_INDEX, {
                        userid: user.userid,
                        session: user.session
                    }, function(data) {
                        This.jiazai = false;
                        if (data.status == 1) {
                            This.regularData = data.back;
                        }
                    });
                },
                //进入定期详情
                dinqiInfo: function(val) {
                    var web = _openHref({
                        url: 'bill-info.html',
                        id: 'billInfo'
                    })
                    setTimeout(function() {
                        web.evalJS("send('" + val.id + "')");
                    }, 200);
                },
                //定期页面的滚动停滞
                dinqiScroll: function() {
                    var mTop = $('#dinqi-scroll').get(0).offsetTop;
                    var showEl = $('#dinqi-gudin-tit');
                    $('#regular-wrap').scroll(function() {
                        var sTop = $(this).scrollTop();
                        var result = mTop - sTop;
                        if (result < -30) {
                            showEl.show();
                        } else {
                            showEl.hide();
                        }
                    });
                },
                //邀请页
                invitaData: function(off) {
                    if (this.inviNodata) {
                        return;
                    }
                    this.inviNodata = true;
                    var This = this;
                    This.jiazai = true;
                    var user = JSON.parse(localStorage.getItem('cc_user'));
                    _post(INVI, {
                        userid: user.userid,
                        session: user.session,
                        type: This.inviJibie,
                        page: This.inviPage++
                    }, function(data) {
                        This.jiazai = false;
                        if (data.status == 1) {
                            if (off == true) {
                                //是上拉加载过来的
                                for (var i = 0; i < data.back.lists.length; i++) {
                                    This.inviData.lists.push(data.back.lists[i]);
                                }
                            } else {
                                This.inviData = data.back;
                            }
                            if (data.back.lists) {
                                if (data.back.lists.length == 0) {
                                    //没有更多数据
                                    This.inviNodata = true;
                                } else {
                                    //还有更多数据
                                    This.inviNodata = false;
                                }
                            } else {
                                This.inviNodata = true;
                            }
                        } else {
                            This.inviNodata = true;
                        }
                    })
                },
                //邀请页面的滚动停滞  和  分页
                inviScroll: function() {
                    var mTop = $('#yaoqin-scroll-tit').get(0).offsetTop;
                    var showEl = $('#invitation-scrll-tit');

                    var upEl = document.getElementById("ready-new-data");
                    var hei = $('#invitation-wrap').height();

                    var This = this;

                    $('#invitation-wrap').scroll(function() {
                        var sTop = $(this).scrollTop();
                        var result = mTop - sTop;
                        if (result < -30) {
                            showEl.show();
                        } else {
                            showEl.hide();
                        }
                        //判断是不是该上拉加载了
                        var upTop = upEl.offsetTop;
                        if (upTop >= sTop && upTop < sTop + hei) {
                            if (!This.inviNodata) {
                                This.invitaData(true);
                            }
                        }



                    });
                },
                //我的页
                myIndex: function() {
                    var This = this;
                    This.jiazai = true;
                    var user = JSON.parse(localStorage.getItem('cc_user'));
                    _post(MY_INDEX, {
                        userid: user.userid,
                        session: user.session,
                    }, function(data) {
                        This.jiazai = false;
                        if (data.status == 1) {
                        	console.log('首页数据');
                        	console.log(JSON.stringify(data))
                            This.myData = data.back;
                        } else {
                            _toast(data.msg);
                        }
                    })
                },
                //交易密码设置
                setTran: function() {
                    if (this.myData.is_pin == 1) {
                        //没设置交易密码
                        _openHref({
                            url: 'no-trans-pas.html',
                            id: 'noTransPas'
                        });
                    } else {
                        //设置了交易密码
                        _openHref({
                            url: 'hava-trans-set.html',
                            id: 'havaTransSet'
                        });
                    }
                },
                //去到通知详情
                goNotice: function() {
                    var h = this.noti.description;
                    if (h) {
                        //打开外部浏览器
                        this.jiazai = true;
                        var This = this;
                        var web = plus.webview.create(h, 'a', {
                            'backButtonAutoControl': 'close', //返回是关闭当前页
                            'animationOptimization': 'none', //不优化
                        });
                        web.addEventListener("loaded", function() {
                            setTimeout(function() {
                                This.jiazai = false;
                                web.show('slide-in-right');
                            }, 200);
                        }, false);
                        this.noti = false;
                    } else {
                        var id = this.noti.id;
                        this.noti = false;
                        //打开内部页面
                        var web = _openHref({
                            url: 'noti-info.html',
                            id: 'notiInfo'
                        });
                        setTimeout(function() {
                            web.evalJS("send('" + id + "')");
                        }, 300);
                    }

                }
            }
        });
    </script>
    <script>
        function plusReady() {
            update();
            var first = null;
            mui.back = function() {
                //首次按键，提示‘再按一次退出应用’
                if (!first) {
                    first = new Date().getTime();
                    plus.nativeUI.toast("再按一次退出程序");
                    setTimeout(function() {
                        first = null;
                    }, 1000);
                } else {
                    if (new Date().getTime() - first < 1000) {
                        plus.runtime.quit();
                    }
                }
            };
            //处理封号与否
            // {"userid":"4","phone":"18875027065","usercode":"475292","is_frozen":"2","session":"Yc2cNt0obk2etnlbl80"}
            var clearSe = setInterval(function() {
                var user = JSON.parse(localStorage.getItem('cc_user'));
                _post(FRO_ZEN, {
                    userid: user.userid,
                    session: user.session
                }, function(data) {
                	var ccUser=JSON.parse(localStorage.getItem('cc_user'));
                	ccUser.downUrl=data.back.app_url;
                	localStorage.setItem('cc_user',JSON.stringify(ccUser));
                    if (data.back.is_frozen == 1) {
                        clearInterval(clearSe);
                        localStorage.setItem('cc_user', '');
                        plus.nativeUI.alert("您的账号已被冻结，请联系管理员", function() {
                            _openHref({
                                url: 'login.html',
                                id: 'login'
                            });
                        }, "冻结提醒", "确定");
                        return;
                    }
                    var session = user.session;
                    if (data.back.session != session) {
                        clearInterval(clearSe);
                        localStorage.setItem('cc_user', '');
                        plus.nativeUI.alert("您的账号已在其他设备登陆，您已被迫下线", function() {
                            _openHref({
                                url: 'login.html',
                                id: 'login'
                            });
                        }, "冻结提醒", "确定");
                    }
                })
            }, 8000);
            //处理封号与否
            var index = plus.webview.currentWebview();
            var all = plus.webview.all();
            var indexUrl = index.getURL();
            setTimeout(function() {
                var curr = '';
                for (var i = 0; i < all.length; i++) {
                    curr = all[i].getURL();
                    if (curr != indexUrl) {
                        all[i].hide();
                    }
                }
            }, 4000);
            setTimeout(function() {
                var curr = '';
                for (var i = 0; i < all.length; i++) {
                    curr = all[i].getURL();
                    if (curr != indexUrl) {
                        all[i].close('none');
                    }
                }
            }, 7000);
        }
        // 判断扩展API是否准备，否则监听'plusready'事件
        if (window.plus) {
            plusReady();
        } else {
            document.addEventListener('plusready', plusReady, false);
        }
    </script>
</body>

</html>